package cclub.demo.response;

import java.util.HashMap;

public class ServiceResponse {

    private static HashMap<String,Object> serviceResMap;
    //为了不过多的创建返回对象,就用懒汉单例
    private static HashMap<String,Object> getInstance(){
        if(serviceResMap == null){
            serviceResMap =  new HashMap<>();
        }
        return serviceResMap;
    }

    public static HashMap success(){
        HashMap<String,Object> map = getInstance();
        map.put("status",CodeEnum.SUCCESS.getCode());
        return map;
    }

    public static HashMap error(){
        HashMap<String,Object> map = getInstance();
        map.put("status",CodeEnum.FAIL.getCode());
        return map;
    }
}
